


#include "stdafx.h"
#include "AppObject.h"



pair<long unsigned int, long unsigned int> AppObject::TotalCount(signed short Info){
		if(-1 > Info || Info > 1) throw AppObjectException("AppObject::TotalCount");
		static long unsigned int ObjectsTotal    = 0;
		static long unsigned int NextAvailableID = 0;
		ObjectsTotal += Info;
		if(Info == 1) NextAvailableID++;
		return pair<unsigned int, unsigned int>(ObjectsTotal, NextAvailableID);
}

string AppObject::toString() const{
	stringstream buff;
	buff<<this->m_ID;
	return buff.str();
}



AppObject::AppObject( ){ 	
	pair<long unsigned int, long unsigned int> Info = AppObject::TotalCount(1);
	this->m_ID = Info.second;		
}
 
AppObject::AppObject(AppObject::const_reference AO){
	AppObject::TotalCount(1);
	this->m_ID = AO.m_ID;
}


AppObject::~AppObject( ){
	AppObject::TotalCount(-1);	
}
